home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
001
/
pibt3sp4.arc
/
SETPARMB.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-10-08
|
48KB
|
1,441 lines
(*----------------------------------------------------------------------*)
(* Get_Default_Params --- Set Communications Parameters *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Get_Default_Params( First_Time : BOOLEAN );
(*----------------------------------------------------------------------*)
(* *)
(* Procedure: Get_Default_Params *)
(* *)
(* Purpose: Set communications parameters *)
(* *)
(* Calling Sequence: *)
(* *)
(* Get_Default_Params( First_Time ); *)
(* *)
(* First_Time: TRUE for initial setup, else FALSE. *)
(* *)
(* Calls: ClrScr *)
(* Async_Init *)
(* Async_Open *)
(* Menu_Get_Choice *)
(* Menu_Display_Choices *)
(* *)
(* Remarks: *)
(* *)
(* This routine is called if PIBTERM.CNF doesn't exist, *)
(* or to update communications parameters. *)
(* *)
(*----------------------------------------------------------------------*)
VAR
Settings_Menu : Menu_Type;
Settings_Choice : INTEGER;
I : INTEGER;
J : INTEGER;
(*----------------------------------------------------------------------*)
(* Get_Baud_Rate --- Get Baud Rate for Communications *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Get_Baud_Rate;
CONST
Baud_Rates: ARRAY[ 1 .. 8 ] OF INTEGER
= ( 110, 150, 300, 600, 1200, 2400, 4800, 9600 );
VAR
Baud_Menu : Menu_Type;
I : INTEGER;
J : INTEGER;
BEGIN (* Get_Baud_Rate *)
(* Get Baud Rate *)
WITH Baud_Menu DO
BEGIN
Menu_Size := 8;
Menu_Row := 11;
Menu_Column := 30;
Menu_Tcolor := Menu_Text_Color;
Menu_Bcolor := BackGround_Color;
Menu_Fcolor := Menu_Frame_Color;
Menu_Width := 0;
Menu_Height := 0;
CASE Baud_Rate OF
110 : Menu_Default := 1;
150 : Menu_Default := 2;
300 : Menu_Default := 3;
600 : Menu_Default := 4;
1200: Menu_Default := 5;
2400: Menu_Default := 6;
4800: Menu_Default := 7;
9600: Menu_Default := 8;
END (* CASE *);
END (* WITH *);
FOR I := 1 TO 8 DO
WITH Baud_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := 'a) 110';
2: Menu_Item_Text := 'b) 150';
3: Menu_Item_Text := 'c) 300';
4: Menu_Item_Text := 'd) 600';
5: Menu_Item_Text := 'e) 1200';
6: Menu_Item_Text := 'f) 2400';
7: Menu_Item_Text := 'g) 4800';
8: Menu_Item_Text := 'h) 9600';
END (* CASE *);
END;
Baud_Menu.Menu_Title := 'Choose Baud Rate: ';
Menu_Display_Choices( Baud_Menu );
Baud_Rate := Baud_Rates[ Menu_Get_Choice( Baud_Menu , Erase_Menu ) ];
END (* Get_Baud_Rate *);
(*----------------------------------------------------------------------*)
(* Get_Comm_Port --- Get Port Number for Communications *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Get_Comm_Port;
VAR
Port_Menu : Menu_Type;
I : INTEGER;
J : INTEGER;
BEGIN (* Get_Comm_Port *)
(* Get port number *)
WITH Port_Menu DO
BEGIN
Menu_Size := 2;
Menu_Default := Comm_Port;
Menu_Row := 11;
Menu_Column := 30;
Menu_Tcolor := Menu_Text_Color;
Menu_Bcolor := BackGround_Color;
Menu_Fcolor := Menu_Frame_Color;
Menu_Width := 0;
Menu_Height := 0;
END (* WITH Port_Menu *);
FOR I := 1 TO 2 DO
WITH Port_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := 'a) Serial Port 1';
2: Menu_Item_Text := 'b) Serial Port 2';
END (* CASE *);
END;
Port_Menu.Menu_Title := 'Which Communications Port: ';
Menu_Display_Choices( Port_Menu );
I := Comm_Port;
Comm_Port := Menu_Get_Choice( Port_Menu , Erase_Menu );
(* Remember if port changed *)
Comm_Port_Changed := ( Comm_Port <> I );
END (* Get_Comm_Port *);
(*----------------------------------------------------------------------*)
(* Get_Parity --- Get Parity for Communications *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Get_Parity;
CONST
Parities: ARRAY[ 1 .. 3 ] OF Char
= ( 'E', 'O', 'N' );
VAR
Parity_Menu : Menu_Type;
I : INTEGER;
J : INTEGER;
BEGIN (* Get_Parity *)
(* Get Parity *)
WITH Parity_Menu DO
BEGIN
Menu_Size := 3;
CASE Parity OF
'E' : Menu_Default := 1;
'O' : Menu_Default := 2;
'N' : Menu_Default := 3;
END (* CASE *);
Menu_Row := 11;
Menu_Column := 30;
Menu_Tcolor := Menu_Text_Color;
Menu_Bcolor := BackGround_Color;
Menu_Fcolor := Menu_Frame_Color;
Menu_Width := 0;
Menu_Height := 0;
END (* WITH Parity_Menu *);
FOR I := 1 to 3 DO
WITH Parity_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := 'Even';
2: Menu_Item_Text := 'Odd';
3: Menu_Item_Text := 'None';
END (* CASE *);
END;
Parity_Menu.Menu_Title := 'Choose Parity: ';
Menu_Display_Choices( Parity_Menu );
Parity := Parities[ Menu_Get_Choice( Parity_Menu , Erase_Menu ) ];
END (* Get_Parity *);
(*----------------------------------------------------------------------*)
(* Get_Stop_Bits --- Get Stop Bits for Communications *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Get_Stop_Bits;
CONST
Stop_Data: ARRAY[ 1 .. 2 ] OF INTEGER
= ( 1 , 2 );
VAR
Stop_Menu : Menu_Type;
I : INTEGER;
J : INTEGER;
BEGIN (* Get_Stop_Bits *)
(* Get stop bits *)
WITH Stop_Menu DO
BEGIN
Menu_Size := 2;
Menu_Default := Stop_Bits;
Menu_Row := 11;
Menu_Column := 30;
Menu_Tcolor := Menu_Text_Color;
Menu_Bcolor := BackGround_Color;
Menu_Fcolor := Menu_Frame_Color;
Menu_Width := 0;
Menu_Height := 0;
END (* WITH Stop_Menu *);
FOR I := 1 to 2 DO
WITH Stop_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := '1';
2: Menu_Item_Text := '2';
END (* CASE *);
END;
Stop_Menu.Menu_Title := 'Number of Stop Bits: ';
Menu_Display_Choices( Stop_Menu );
Stop_Bits := Stop_Data[ Menu_Get_Choice( Stop_Menu , Erase_Menu ) ];
END (* Get_Stop_Bits *);
(*----------------------------------------------------------------------*)
(* Get_Data_Bits --- Get Stop Bits for Communications *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Get_Data_Bits;
CONST
Char_Bits: ARRAY[ 1 .. 2 ] OF INTEGER
= ( 7 , 8 );
VAR
Bits_Menu : Menu_Type;
I : INTEGER;
J : INTEGER;
BEGIN (* Get_Data_Bits *)
(* Get Bits per Character *)
WITH Bits_Menu DO
BEGIN
Menu_Size := 2;
Menu_Default := Data_Bits - 6;
Menu_Row := 11;
Menu_Column := 30;
Menu_Tcolor := Menu_Text_Color;
Menu_Bcolor := BackGround_Color;
Menu_Fcolor := Menu_Frame_Color;
Menu_Width := 0;
Menu_Height := 0;
END (* WITH Bits_Menu *);
FOR I := 1 to 2 DO
WITH Bits_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := '7';
2: Menu_Item_Text := '8';
END (* CASE *);
END;
Bits_Menu.Menu_Title := 'Data Bits in Each Character: ';
Menu_Display_Choices( Bits_Menu );
Data_Bits := Char_Bits[ Menu_Get_Choice( Bits_Menu , Erase_Menu ) ];
END (* Get_Data_Bits *);
(*----------------------------------------------------------------------*)
(* Get_BackSpace --- Get type of Backspace/Delete *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Get_BackSpace;
VAR
BS_Menu : Menu_Type;
I : INTEGER;
J : INTEGER;
BEGIN (* Get_BackSpace *)
(* Get BackSpace Key Use *)
WITH BS_Menu DO
BEGIN
Menu_Size := 2;
Menu_Row := 11;
Menu_Column := 30;
Menu_Tcolor := Menu_Text_Color;
Menu_Bcolor := BackGround_Color;
Menu_Fcolor := Menu_Frame_Color;
Menu_Width := 0;
Menu_Height := 0;
IF BS_Char = CHR( BS ) THEN
Menu_Default := 1
ELSE
Menu_Default := 2;
END (* WITH BS_Menu *);
FOR I := 1 TO 2 DO
WITH BS_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := 'Backspace (ASCII 08)';
2: Menu_Item_Text := 'Delete (ASCII 127)';
END (* CASE *);
END;
BS_Menu.Menu_Title := 'Backspace key sends: ';
Menu_Display_Choices( BS_Menu );
CASE Menu_Get_Choice( BS_Menu, Erase_Menu ) OF
1: BEGIN
BS_Char := CHR( BS );
Ctrl_BS_Char := CHR( DEL );
END;
2: BEGIN
BS_Char := CHR( DEL );
Ctrl_BS_Char := CHR( BS );
END;
END (* CASE *);
END (* Get_BackSpace *);
(*----------------------------------------------------------------------*)
(* Get_LineFeeds --- Get CR/LF definition *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Get_LineFeeds;
VAR
LF_Menu : Menu_Type;
I : INTEGER;
J : INTEGER;
BEGIN (* Get_LineFeeds *)
(* Get CR/LF Key Use *)
WITH LF_Menu DO
BEGIN
Menu_Size := 2;
Menu_Row := 11;
Menu_Column := 30;
Menu_Tcolor := Menu_Text_Color;
Menu_Bcolor := BackGround_Color;
Menu_Fcolor := Menu_Frame_Color;
Menu_Width := 0;
Menu_Height := 0;
IF Add_LF THEN
Menu_Default := 2
ELSE
Menu_Default := 1;
END;
FOR I := 1 To 2 DO
WITH LF_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := 'a) CR only';
2: Menu_Item_Text := 'b) CR + LF';
END (* CASE *);
END;
LF_Menu.Menu_Title := 'Incoming carriage return acts like: ';
Menu_Display_Choices( LF_Menu );
Add_LF := ( Menu_Get_Choice( LF_Menu, Erase_Menu ) = 2 );
END (* Get_LineFeeds *);
(*----------------------------------------------------------------------*)
(* Get_Terminal_Type --- Get Type of Terminal to Emulate *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Get_Terminal_Type;
CONST
Term_Data: ARRAY[ 1 .. 6 ] OF Terminal_Type
= ( Dumb , VT52 , Ansi, VT100 , Gossip , HostMode );
VAR
Emul_Menu : Menu_Type;
I : INTEGER;
J : INTEGER;
BEGIN (* Get_Terminal_Type *)
(* Get terminal type to emulate *)
Emul_Menu.Menu_Size := 6;
CASE Terminal_To_Emulate OF
Dumb: Emul_Menu.Menu_Default := 1;
VT52: Emul_Menu.Menu_Default := 2;
Ansi: Emul_Menu.Menu_Default := 3;
VT100: Emul_Menu.Menu_Default := 4;
Gossip: Emul_Menu.Menu_Default := 5;
HostMode: Emul_Menu.Menu_Default := 6;
END (* CASE *);
Emul_Menu.Menu_Row := 11;
Emul_Menu.Menu_Column := 30;
Emul_Menu.Menu_Tcolor := Menu_Text_Color;
Emul_Menu.Menu_Bcolor := BackGround_Color;
Emul_Menu.Menu_Fcolor := Menu_Frame_Color;
Emul_Menu.Menu_Width := 0;
Emul_Menu.Menu_Height := 0;
FOR I := 1 TO 6 DO
WITH Emul_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := 'a) Dumb';
2: Menu_Item_Text := 'b) VT52';
3: Menu_Item_Text := 'c) ANSI';
4: Menu_Item_Text := 'd) VT100';
5: Menu_Item_Text := 'e) Gossip mode';
6: Menu_Item_Text := 'f) Host Mode';
END (* CASE *);
END;
Emul_Menu.Menu_Title := 'Terminal to emulate: ';
Menu_Display_Choices( Emul_Menu );
Terminal_To_Emulate := Term_Data[ Menu_Get_Choice( Emul_Menu , Erase_Menu ) ];
END (* Get_Terminal_Type *);
(*----------------------------------------------------------------------*)
(* Get_Modem_Setup --- Get setup values for modem *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Get_Modem_Setup;
VAR
Modem_Menu : Menu_Type;
I : INTEGER;
J : INTEGER;
Modem_Item : INTEGER;
Done : BOOLEAN;
Local_Save : Saved_Screen_Ptr;
Local_Save2 : Saved_Screen_Ptr;
Param_Str : AnyStr;
Param_Ival : INTEGER;
Param_Rval : REAL;
P_Str : AnyStr;
BEGIN (* Get_Modem_Setup *)
(* Save screen *)
Save_Screen( Local_Save2 );
(* Get modem setup *)
Modem_Menu.Menu_Size := 16;
Modem_Menu.Menu_Row := 5;
Modem_Menu.Menu_Column := 30;
Modem_Menu.Menu_Tcolor := Menu_Text_Color;
Modem_Menu.Menu_Bcolor := BackGround_Color;
Modem_Menu.Menu_Fcolor := Menu_Frame_Color;
Modem_Menu.Menu_Width := 0;
Modem_Menu.Menu_Height := 0;
Modem_Menu.Menu_Default := 16;
FOR I := 1 TO 16 DO
WITH Modem_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := 'a) Initialization String';
2: Menu_Item_Text := 'b) Dialing command prefix';
3: Menu_Item_Text := 'c) Connect message';
4: Menu_Item_Text := 'd) No Carrier message';
5: Menu_Item_Text := 'e) Busy message';
6: Menu_Item_Text := 'f) Escape string';
7: Menu_Item_Text := 'g) Escape Delay (ms)';
8: Menu_Item_Text := 'h) Hang Up string';
9: Menu_Item_Text := 'i) Dialing Timeout (secs)';
10: Menu_Item_Text := 'j) Redial Time (secs)';
11: Menu_Item_Text := 'k) Answer phone string';
12: Menu_Item_Text := 'l) Host mode setup';
13: Menu_Item_Text := 'm) Intercharacter delay (ms)';
14: Menu_Item_Text := 'n) Carrier line high';
15: Menu_Item_Text := 'o) Host mode auto speed detect';
16: Menu_Item_Text := 'q) Quit modem setup';
END (* CASE *);
END;
Modem_Menu.Menu_Title := 'Choose modem item to set: ';
Done := FALSE;
Modem_Item := 0;
(* If first time, display *)
(* modem header. *)
IF First_Time THEN
BEGIN
Draw_Menu_Frame( 10, 10, 40, 13, Menu_Frame_Color,
Menu_Text_Color, '' );
GoToXY( 1 , 1 );
ClrEol;
WRITE('Modem Setup');
END;
REPEAT
(* If first time initialization, *)
(* proceed through each modem *)
(* item in turn. *)
IF First_Time THEN
BEGIN
Modem_Item := Modem_Item + 1;
END
ELSE
BEGIN
Menu_Display_Choices( Modem_Menu );
Modem_Item := Menu_Get_Choice( Modem_Menu , Dont_Erase_Menu );
END;
IF Modem_Item <> 16 THEN
BEGIN
Save_Screen( Local_Save );
WITH Modem_Menu.Menu_Entries[Modem_Item] DO
P_Str := 'Enter Modem ' + COPY( Menu_Item_Text, 4,
LENGTH( Menu_Item_Text ) - 3 );
Draw_Menu_Frame( 10, 20, 65, 24, Menu_Frame_Color,
Menu_Text_Color, P_Str );
Window( 11, 21, 64, 23 );
GoToXY( 1 , 1 );
WRITE('Current value: ');
CASE Modem_Item OF
1 : WRITE( Modem_Init );
2 : WRITE( Modem_Dial );
3 : WRITE( Modem_Connect );
4 : WRITE( Modem_No_Carrier );
5 : WRITE( Modem_Busy );
6 : WRITE( Modem_Escape );
7 : WRITE( Modem_Escape_Time );
8 : WRITE( Modem_Hang_Up );
9 : WRITE( Modem_Time_Out:4:0 );
10 : WRITE( Modem_Redial_Delay:4:0 );
11 : WRITE( Modem_Answer );
12 : WRITE( Modem_Host_Set );
13 : WRITE( Modem_Command_Delay );
14 : IF Modem_Carrier_High THEN
WRITE('Always on')
ELSE
WRITE('Not always on');
15 : IF Host_Auto_Baud THEN
WRITE('Detect speed from modem')
ELSE
WRITE('Detect speed from user input');
ELSE ;
END (* CASE *);
GoToXY( 1 , 2 );
ClrEol;
WRITE('--> ');
IF Modem_Item = 14 THEN
BEGIN
Modem_Carrier_High :=
YesNo('Is Carrier Detect Signal Always On (Y/N) ');
END
ELSE IF Modem_Item = 15 THEN
BEGIN
Host_Auto_Baud :=
YesNo('Try automatic speed detect in host mode (Y/N) ');
END
ELSE
BEGIN
READLN( Param_Str );
IF ( LENGTH( Param_Str ) > 0 ) THEN
BEGIN
Param_Ival := 0;
Param_Str := Read_Ctrls( TRIM( Param_Str ) );
FOR I := 1 TO LENGTH( Param_Str ) DO
IF Param_Str[I] IN ['0'..'9'] THEN
Param_Ival := Param_Ival * 10 +
ORD( Param_Str[I] ) - ORD( '0' );
Param_Rval := Param_Ival;
CASE Modem_Item OF
1 : Modem_Init := Param_Str;
2 : Modem_Dial := Param_Str;
3 : Modem_Connect := Param_Str;
4 : Modem_No_Carrier := Param_Str;
5 : Modem_Busy := Param_Str;
6 : Modem_Escape := Param_Str;
7 : Modem_Escape_Time := Param_Ival;
8 : Modem_Hang_Up := Param_Str;
9 : Modem_Time_Out := Param_Rval;
10 : Modem_Redial_Delay := Param_Rval;
11 : Modem_Answer := Param_Str;
12 : Modem_Host_Set := Param_Str;
13 : Modem_Command_Delay := Param_Ival;
ELSE ;
END (* CASE *);
END (* LENGTH( Param_Str ) > 0 *);
END;
Restore_Screen( Local_Save );
END (* Modem_Item <> 16 *)
ELSE
Done := TRUE;
UNTIL Done;
Restore_Screen( Local_Save2 );
END (* Get_Modem_Setup *);
(*----------------------------------------------------------------------*)
(* Get_Default_Transfer_Protocol --- get protocol for file transfers *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Get_Default_Transfer_Protocol;
VAR
Transfer_Menu : Menu_Type;
I : INTEGER;
BEGIN (* Get_Default_Transfer_Protocol *)
Transfer_Menu.Menu_Size := 10;
Transfer_Menu.Menu_Row := 10;
Transfer_Menu.Menu_Column := 30;
Transfer_Menu.Menu_Tcolor := Menu_Text_Color;
Transfer_Menu.Menu_Bcolor := BackGround_Color;
Transfer_Menu.Menu_Fcolor := Menu_Frame_Color;
Transfer_Menu.Menu_Width := 40;
Transfer_Menu.Menu_Height := 0;
CASE Default_Transfer_Type OF
Ascii: Transfer_Menu.Menu_Default := 1;
Xmodem_Chk: Transfer_Menu.Menu_Default := 2;
Xmodem_Crc: Transfer_Menu.Menu_Default := 3;
Kermit: Transfer_Menu.Menu_Default := 4;
Telink: Transfer_Menu.Menu_Default := 5;
Modem7_Chk: Transfer_Menu.Menu_Default := 6;
Modem7_CRC: Transfer_Menu.Menu_Default := 7;
Ymodem: Transfer_Menu.Menu_Default := 8;
Ymodem_Batch: Transfer_Menu.Menu_Default := 9;
None: Transfer_Menu.Menu_Default := 10;
END (* CASE *);
FOR I := 1 TO 10 DO
WITH Transfer_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := 'a) Ascii';
2: Menu_Item_Text := 'b) Xmodem (Checksum)';
3: Menu_Item_Text := 'c) Xmodem (CRC)';
4: Menu_Item_Text := 'd) Kermit';
5: Menu_Item_Text := 'e) Telink';
6: Menu_Item_Text := 'f) Modem7 (Checksum)';
7: Menu_Item_Text := 'g) Modem7 (CRC)';
8: Menu_Item_Text := 'h) Ymodem';
9: Menu_Item_Text := 'i) Ymodem (Batch)';
10: Menu_Item_Text := 'j) None';
END (* CASE *);
END;
(* Get transfer protocol *)
Transfer_Menu.Menu_Title := 'Default file transfer protocol';
Menu_Display_Choices( Transfer_Menu );
Default_Transfer_Type := Transfers[ Menu_Get_Choice( Transfer_Menu ,
Erase_Menu ) ];
END (* Get_Default_Transfer_Protocol *);
(*----------------------------------------------------------------------*)
(* Get_Screen_Dump_Name --- get file name for screen dumps *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Get_Screen_Dump_Name;
BEGIN (* Get_Screen_Dump_Name *)
Save_Screen( Saved_Screen );
Draw_Menu_Frame( 10, 10, 78, 13, Menu_Frame_Color,
Menu_Text_Color, 'Set screen dump file name' );
WRITE('File name to receive screen dumps? ');
READLN( Screen_Dump_Name );
Restore_Screen( Saved_Screen );
Reset_Global_Colors;
END (* Get_Screen_Dump_Name *);
(*----------------------------------------------------------------------*)
(* Get_Video_Mode_And_Colors --- Get video mode and colors *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Get_Video_Mode_And_Colors;
VAR
Video_Menu : Menu_Type;
Color_Menu : Menu_Type;
I : INTEGER;
J : INTEGER;
BEGIN (* Get_Video_Mode_And_Colors *)
(* Get Video Mode *)
WITH Video_Menu DO
BEGIN
Menu_Size := 2;
Menu_Row := 11;
Menu_Column := 30;
Menu_Tcolor := Menu_Text_Color;
Menu_Bcolor := BackGround_Color;
Menu_Fcolor := Menu_Frame_Color;
Menu_Width := 0;
Menu_Height := 0;
IF Text_Mode = BW80 THEN
Menu_Default := 1
ELSE
Menu_Default := 2;
END (* WITH Video_Menu *);
FOR I := 1 TO 2 DO
WITH Video_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := 'Monochrome (BW80)';
2: Menu_Item_Text := 'Color (C80)';
END (* CASE *);
END;
Video_Menu.Menu_Title := 'Choose Text Mode: ';
Menu_Display_Choices( Video_Menu );
CASE Menu_Get_Choice( Video_Menu, Erase_Menu ) OF
1: New_Text_Mode := BW80;
2: New_Text_Mode := C80;
END (* CASE *);
(* Monochrome -- all colors *)
(* become black and white *)
IF New_Text_Mode = BW80 THEN
BEGIN
New_ForeGround_Color := White;
New_BackGround_Color := Black;
New_Menu_Text_Color := White;
New_Menu_Frame_Color := White;
VT100_ForeGround_Color := LightGray;
VT100_BackGround_Color := Black;
VT100_Underline_Color := Blue;
VT100_Bold_Color := White;
END
ELSE (* Color -- give them a choice *)
BEGIN (* Choose colors *)
(* Set up color menu *)
WITH Color_Menu DO
BEGIN
Menu_Size := 16;
Menu_Row := 6;
Menu_Column := 30;
Menu_Tcolor := Menu_Text_Color;
Menu_Bcolor := BackGround_Color;
Menu_Fcolor := Menu_Frame_Color;
Menu_Width := 0;
Menu_Height := 0;
END (* WITH Color_Menu *);
FOR I := 1 TO 16 DO
WITH Color_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := 'a) Black';
2: Menu_Item_Text := 'b) Blue';
3: Menu_Item_Text := 'c) Green';
4: Menu_Item_Text := 'd) Cyan';
5: Menu_Item_Text := 'e) Red';
6: Menu_Item_Text := 'f) Magenta';
7: Menu_Item_Text := 'g) Brown';
8: Menu_Item_Text := 'h) LightGray';
9: Menu_Item_Text := 'i) DarkGray';
10: Menu_Item_Text := 'j) LightBlue';
11: Menu_Item_Text := 'k) LightGreen';
12: Menu_Item_Text := 'l) LightCyan';
13: Menu_Item_Text := 'm) LightRed';
14: Menu_Item_Text := 'n) LightMagenta';
15: Menu_Item_Text := 'o) Yellow';
16: Menu_Item_Text := 'p) White';
END (* CASE *);
END;
(* Get foreground *)
Color_Menu.Menu_Title := 'Foreground Color: ';
Color_Menu.Menu_Default := ForeGround_Color + 1;
Menu_Display_Choices( Color_Menu );
New_ForeGround_Color := Menu_Get_Choice( Color_Menu , Erase_Menu ) - 1;
(* Get background *)
Color_Menu.Menu_Title := 'Background Color: ';
Color_Menu.Menu_Default := BackGround_Color + 1;
Menu_Display_Choices( Color_Menu );
New_BackGround_Color := Menu_Get_Choice( Color_Menu, Erase_Menu ) - 1;
(* Menu frame color *)
Color_Menu.Menu_Title := 'Menu Frame Color: ';
Color_Menu.Menu_Default := Menu_Frame_Color + 1;
Menu_Display_Choices( Color_Menu );
New_Menu_Frame_Color := Menu_Get_Choice( Color_Menu, Erase_Menu ) - 1;
(* Menu text color *)
Color_Menu.Menu_Title := 'Menu Text Color: ';
Color_Menu.Menu_Default := Menu_Text_Color + 1;
Menu_Display_Choices( Color_Menu );
New_Menu_Text_Color := Menu_Get_Choice( Color_Menu, Erase_Menu ) - 1;
(* VT100 foreground color *)
Color_Menu.Menu_Title := 'VT100 Foreground Color: ';
Color_Menu.Menu_Default := VT100_ForeGround_Color + 1;
Menu_Display_Choices( Color_Menu );
VT100_ForeGround_Color := Menu_Get_Choice( Color_Menu, Erase_Menu ) - 1;
(* VT100 background color *)
Color_Menu.Menu_Title := 'VT100 Background Color: ';
Color_Menu.Menu_Default := VT100_BackGround_Color + 1;
Menu_Display_Choices( Color_Menu );
VT100_BackGround_Color := Menu_Get_Choice( Color_Menu, Erase_Menu ) - 1;
(* VT100 underline color *)
Color_Menu.Menu_Title := 'VT100 Underline Color: ';
Color_Menu.Menu_Default := VT100_Underline_Color + 1;
Menu_Display_Choices( Color_Menu );
VT100_Underline_Color := Menu_Get_Choice( Color_Menu, Erase_Menu ) - 1;
(* VT100 bolding color *)
Color_Menu.Menu_Title := 'VT100 Bold Color: ';
Color_Menu.Menu_Default := VT100_Bold_Color + 1;
Menu_Display_Choices( Color_Menu );
VT100_Bold_Color := Menu_Get_Choice( Color_Menu, Erase_Menu ) - 1;
END (* Choose colors *);
END (* Get_Video_Mode_And_Colors *);
(*----------------------------------------------------------------------*)
(* Get_Miscellaneous --- Get miscellaneous parameters *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Get_Miscellaneous;
VAR
Local_Save : Saved_Screen_Ptr;
Local_Save_2 : Saved_Screen_Ptr;
Misc_Menu : Menu_Type;
Done : BOOLEAN;
L : INTEGER;
Choice : INTEGER;
BEGIN (* Get_Miscellaneous *)
(* Save current screen *)
Save_Screen( Local_Save_2 );
(* Set up menu *)
WITH Misc_Menu DO
BEGIN
Menu_Size := 6;
Menu_Row := 11;
Menu_Column := 30;
Menu_Tcolor := Menu_Text_Color;
Menu_Bcolor := BackGround_Color;
Menu_Fcolor := Menu_Frame_Color;
Menu_Width := 0;
Menu_Height := 0;
Menu_Default := 6;
END (* WITH Misc_Menu *);
FOR I := 1 TO 6 DO
WITH Misc_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := 'a) EXEC PC BBS Commands';
2: Menu_Item_Text := 'b) CompuServe B Protocol';
3: Menu_Item_Text := 'c) Exploding menus';
4: Menu_Item_Text := 'd) Review scrolled lines';
5: Menu_Item_Text := 'e) Xmodem download buffer size';
6: Menu_Item_Text := 'q) Quit';
END (* CASE *);
END;
Misc_Menu.Menu_Title := 'Miscellaneous Parameters: ';
Done := FALSE;
(* Loop over menu choices *)
REPEAT
Menu_Display_Choices( Misc_Menu );
Choice := Menu_Get_Choice( Misc_Menu, Dont_Erase_Menu );
IF Choice <> 6 THEN
BEGIN
Save_Screen( Local_Save );
Draw_Menu_Frame( 10, 20, 65, 24, Menu_Frame_Color,
Menu_Text_Color, '' );
Window( 11, 21, 64, 23 );
GoToXY( 1 , 1 );
CASE Choice OF
1: Mahoney_On := YesNo('Execute EXEC PC BBS commands in VT52 mode? ');
2: CompuServe_B_On := YesNo('Execute CompuServe B Protocol? ');
3: BEGIN
Exploding_Menus := YesNo('Use exploding menus? ');
Menu_Set_Explode( Exploding_Menus );
END;
4: BEGIN
WRITE('Enter number of lines to use for review buffer: ');
L := Max_Review_Length;
READLN( Max_Review_Length );
Max_Review_Length := MIN( MAX( Max_Review_Length , 0 ) ,
800 );
IF ( L > 0 ) AND ( Review_Buffer <> NIL ) THEN
BEGIN
FreeMem( Review_Buffer , 81 * L );
Review_Buffer := NIL;
END;
L := 81 * Max_Review_Length;
IF L > ( MaxBlockAvail - 32000.0 ) THEN
BEGIN
Max_Review_Length := MAX( 0 ,
TRUNC( ( MaxBlockAvail - 32000.0 ) / 81.0 ) );
L := 81 * Max_Review_Length;
END;
Review_On := ( Max_Review_Length > 0 );
IF Review_On THEN
GetMem( Review_Buffer , L );
Review_Head := 0;
Review_Tail := 0;
Review_Line := '';
END;
5: BEGIN
WRITE('Enter size in bytes for Xmodem download buffer: ');
READLN( Max_Write_Buffer );
Max_Write_Buffer :=
MAX( ( ( Max_Write_Buffer + 127 ) DIV 128 ) * 128,
128 );
END;
6: Done := TRUE;
ELSE;
END (* CASE *);
Restore_Screen( Local_Save );
Reset_Global_Colors;
END
ELSE
Done := TRUE;
UNTIL Done;
(* Restore previous screen *)
Restore_Screen( Local_Save_2 );
END (* Get_Miscellaneous *);
(*----------------------------------------------------------------------*)
(* Get_Kermit_Params --- Get Kermit protocol parameters *)
(*----------------------------------------------------------------------*)
OVERLAY PROCEDURE Get_Kermit_Params;
VAR
Kermit_Menu : Menu_Type;
I : INTEGER;
J : INTEGER;
Kermit_Item : INTEGER;
Done : BOOLEAN;
Local_Save : Saved_Screen_Ptr;
Local_Save2 : Saved_Screen_Ptr;
Param_Str : AnyStr;
Param_Ival : INTEGER;
Param_Rval : REAL;
P_Str : AnyStr;
(*----------------------------------------------------------------------*)
FUNCTION SIval( I: INTEGER ) : ShortStr;
VAR
IWidth : INTEGER;
ISave : INTEGER;
S : ShortStr;
BEGIN (* SIval *)
IWidth := 0;
ISave := I;
WHILE( ISave > 0 ) DO
BEGIN
IWidth := IWidth + 1;
ISave := ISave DIV 10;
END;
STR( I : IWidth , S );
SIVal := S;
END (* SIval *);
(*----------------------------------------------------------------------*)
PROCEDURE Get_Kermit_Menu_Line( I: INTEGER );
BEGIN (* Get_Kermit_Menu_Line *)
WITH Kermit_Menu.Menu_Entries[I] DO
BEGIN
CASE I OF
1: Menu_Item_Text :=
'a) Checksum type (now ' + Kermit_Chk_Type + ')';
2: BEGIN
Menu_Item_Text := 'b) Debug mode (now ';
IF Kermit_Debug THEN
Menu_Item_Text := Menu_Item_Text + 'ON)'
ELSE
Menu_Item_Text := Menu_Item_Text + 'OFF)';
END;
3: Menu_Item_Text := 'c) End of line (now Ascii ' +
SIval( ORD( Kermit_EOL ) ) + ')';
4: Menu_Item_Text := 'd) Packet header (now Ascii ' +
SIval( ORD( Kermit_Header_Char ) ) + ')';
5: Menu_Item_Text := 'e) Number of pad characters (now ' +
SIval( Kermit_NPad ) + ')';
6: Menu_Item_Text := 'f) Pad character (now Ascii ' +
SIval( ORD( Kermit_Pad_Char ) ) + ')';
7: Menu_Item_Text := 'g) Control quote (now Ascii ' +
SIval( ORD( Kermit_Quote_Char ) ) + ')';
8: Menu_Item_Text := 'h) 8 bit quote (now Ascii ' +
SIval( ORD( Kermit_Quote_8_Char ) ) + ')';
9: Menu_Item_Text := 'i) Repeat data (now Ascii ' +
SIval( ORD( Kermit_Repeat_Char ) ) + ')';
10: Menu_Item_Text := 'j) Packet size (now ' +
SIval( Kermit_Packet_Size ) + ')';
11: Menu_Item_Text := 'k) Timeout in seconds (now ' +
SIval( Kermit_TimeOut ) + ')';
12: Menu_Item_Text := 'k) Send delay in seconds (now ' +
SIval( Kermit_Delay_Time ) + ')';
13: Menu_Item_Text := 'q) Quit Kermit definitions';
END (* CASE *);
END;
END (* Get_Kermit_Menu_Line *);
(*----------------------------------------------------------------------*)
BEGIN (* Get_Kermit_Params *)
(* Save screen *)
Save_Screen( Local_Save2 );
(* Get Kermit setup *)
Kermit_Menu.Menu_Size := 13;
Kermit_Menu.Menu_Row := 5;
Kermit_Menu.Menu_Column := 15;
Kermit_Menu.Menu_Tcolor := Menu_Text_Color;
Kermit_Menu.Menu_Bcolor := BackGround_Color;
Kermit_Menu.Menu_Fcolor := Menu_Frame_Color;
Kermit_Menu.Menu_Width := 50;
Kermit_Menu.Menu_Height := 0;
Kermit_Menu.Menu_Default := 13;
FOR I := 1 TO 13 DO
WITH Kermit_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
Get_Kermit_Menu_Line( I );
END;
Kermit_Menu.Menu_Title := 'Choose Kermit item to set: ';
Done := FALSE;
Kermit_Item := 0;
(* If first time, display *)
(* modem header. *)
IF First_Time THEN
BEGIN
Draw_Menu_Frame( 10, 10, 40, 13, Menu_Frame_Color,
Menu_Text_Color, '' );
GoToXY( 1 , 1 );
ClrEol;
WRITE('Kermit parameters');
END;
REPEAT
(* If first time initialization, *)
(* proceed through each modem *)
(* item in turn. *)
IF First_Time THEN
BEGIN
Kermit_Item := Kermit_Item + 1;
END
ELSE
BEGIN
Menu_Display_Choices( Kermit_Menu );
Kermit_Item := Menu_Get_Choice( Kermit_Menu , Dont_Erase_Menu );
END;
IF Kermit_Item <> 13 THEN
BEGIN
Save_Screen( Local_Save );
WITH Kermit_Menu.Menu_Entries[Kermit_Item] DO
P_Str := 'Enter Kermit ' + COPY( Menu_Item_Text, 4,
LENGTH( Menu_Item_Text ) - 3 );
Draw_Menu_Frame( 10, 20, 65, 24, Menu_Frame_Color,
Menu_Text_Color, P_Str );
Window( 11, 21, 64, 23 );
GoToXY( 1 , 1 );
ClrEol;
WRITE('--> ');
READLN( Param_Str );
Restore_Screen( Local_Save );
IF ( LENGTH( Param_Str ) > 0 ) THEN
BEGIN
Param_Ival := 0;
Param_Str := Read_Ctrls( TRIM( Param_Str ) );
IF ( LENGTH( Param_Str ) = 0 ) THEN
Param_Str := ' ';
FOR I := 1 TO LENGTH( Param_Str ) DO
IF Param_Str[I] IN ['0'..'9'] THEN
Param_Ival := Param_Ival * 10 + ORD( Param_Str[I] ) -
ORD( '0' );
Param_Rval := Param_Ival;
CASE Kermit_Item OF
1 : Kermit_Chk_Type := Param_Str[1];
2 : Kermit_Debug := ( UpperCase(Param_Str) = 'ON' );
3 : Kermit_EOL := Param_Str[1];
4 : Kermit_Header_Char := Param_Str[1];
5 : Kermit_Npad := MAX( Param_Ival , 0 );
6 : Kermit_Pad_Char := Param_Str[1];
7 : Kermit_Quote_Char := Param_Str[1];
8 : Kermit_Quote_8_Char := Param_Str[1];
9 : Kermit_Repeat_Char := Param_Str[1];
10 : Kermit_Packet_Size := MIN( MAX( Param_Ival , 20 ) , 94 );
11 : Kermit_TimeOut := Param_Ival;
12 : Kermit_Delay_Time := Param_Ival;
ELSE ;
END (* CASE *);
Get_Kermit_Menu_Line( Kermit_Item );
END (* LENGTH( Param_Str ) > 0 *);
END (* Kermit_Item <> 13 *)
ELSE
Done := TRUE;
UNTIL Done;
Restore_Screen( Local_Save2 );
END (* Get_Kermit_Params *);
(*----------------------------------------------------------------------*)
BEGIN (* Get_Default_Params *)
(* If first time, get all params *)
IF First_Time THEN
BEGIN
(* Get other stuff *)
Get_Comm_Port;
Get_Baud_Rate;
Get_Parity;
Get_Data_Bits;
Get_Stop_Bits;
Get_BackSpace;
Get_LineFeeds;
Get_Terminal_Type;
Get_Modem_Setup;
Get_Default_Transfer_Protocol;
Get_Screen_Dump_Name;
Get_Video_Mode_And_Colors;
END (* Not first time -- prompt for *)
(* params to be changed *)
ELSE
BEGIN
Settings_Menu.Menu_Size := 17;
Settings_Menu.Menu_Row := 5;
Settings_Menu.Menu_Column := 30;
Settings_Menu.Menu_Tcolor := Menu_Text_Color;
Settings_Menu.Menu_Bcolor := BackGround_Color;
Settings_Menu.Menu_Fcolor := Menu_Frame_Color;
Settings_Menu.Menu_Width := 0;
Settings_Menu.Menu_Height := 0;
Settings_Menu.Menu_Default := 17;
FOR I := 1 TO 17 DO
WITH Settings_Menu.Menu_Entries[I] DO
BEGIN
Menu_Item_Row := I;
Menu_Item_Column := 2;
CASE I OF
1: Menu_Item_Text := 'a) Communications Port';
2: Menu_Item_Text := 'b) Speed (Baud Rate)';
3: Menu_Item_Text := 'c) Parity';
4: Menu_Item_Text := 'd) Data Bits';
5: Menu_Item_Text := 'e) Stop Bits';
6: Menu_Item_Text := 'f) Backspace';
7: Menu_Item_Text := 'g) Linefeed toggle';
8: Menu_Item_Text := 'h) Terminal Type';
9: Menu_Item_Text := 'i) Modem setup';
10: Menu_Item_Text := 'j) File transfer protocol';
11: Menu_Item_Text := 'k) Kermit parameters';
12: Menu_Item_Text := 'l) Screen dump file name';
13: Menu_Item_Text := 'm) Video mode and colors';
14: Menu_Item_Text := 'n) Miscellaneous';
15: Menu_Item_Text := 's) Execute Script file';
16: Menu_Item_Text := 'w) Write new config file';
17: Menu_Item_Text := 'q) Quit setup';
END (* CASE *);
END;
Settings_Menu.Menu_Title := 'Set parameters';
(* Request setup parameters until *)
(* stop setup selected *)
REPEAT
Menu_Display_Choices( Settings_Menu );
Settings_Choice := Menu_Get_Choice( Settings_Menu , Erase_Menu );
CASE Settings_Choice OF
1: Get_Comm_Port;
2: Get_Baud_Rate;
3: Get_Parity;
4: Get_Data_Bits;
5: Get_Stop_Bits;
6: Get_BackSpace;
7: Get_LineFeeds;
8: Get_Terminal_Type;
9: Get_Modem_Setup;
10: Get_Default_Transfer_Protocol;
11: Get_Kermit_Params;
12: Get_Screen_Dump_Name;
13: Get_Video_Mode_And_Colors;
14: Get_Miscellaneous;
15: Read_In_Script := TRUE;
16: Write_Config_File;
ELSE;
END (* CASE *);
(* Remember if comm parms changed *)
Reset_Comm_Port := Reset_Comm_Port OR ( Settings_Choice <= 5 );
UNTIL ( Settings_Choice = 17 ) OR
Script_File_Mode OR
Read_In_Script;
END;
END (* Get_Default_Params *);